﻿<UserControl
	xmlns="http://schemas.microsoft.com/client/2007"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
	xmlns:sipsorcery="clr-namespace:SIPSorcery;assembly=SIPSorcery" 
	xmlns:sipsorceryui="clr-namespace:SIPSorcery.UIControls;assembly=SIPSorcery" 
	mc:Ignorable="d"
	x:Class="SIPSorcery.SIPProviderManager"
	d:DesignWidth="800" Width="1024" xmlns:SIPSorcery="clr-namespace:SIPSorcery" OpacityMask="#FF181818" Height="Auto" VerticalAlignment="Stretch">

	<UserControl.Resources>
		<sipsorcery:SIPURIConverter x:Key="SIPURIStringConverter" />
		<sipsorcery:DateTimeOffsetConverter x:Key="DateTimeOffsetConverter" />
		<sipsorcery:DateTimeConverter x:Key="DateTimeConverter" />
	</UserControl.Resources>

<StackPanel Height="Auto" x:Name="m_sipProvidersManagerGrid" Width="Auto" Background="#FF000000" ScrollViewer.VerticalScrollBarVisibility="Disabled">
		<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_sipProvidersPanel" Width="Auto" Margin="0,5,0,5">
			<Border BorderBrush="#FFA1FA28" BorderThickness="1,1,1,1" Height="222" x:Name="m_listBorder" Width="1024">
				<data:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_sipProvidersDataGrid" AutoGenerateColumns="False" FontSize="11" 
					RowBackground="Azure"
	            	AlternatingRowBackground="LightSteelBlue" MouseLeftButtonUp="SIPProvidersDataGrid_MouseLeftButtonUp">
					 <data:DataGrid.Columns>
		                <data:DataGridTextColumn 
		                    Header="Provider Name" 
		                    Width="SizeToCells"
		                    Binding="{Binding ProviderName}" 
							IsReadOnly="True"
							MinWidth="110"/>
						<data:DataGridTextColumn 
		                    Header="Type" 
		                    Binding="{Binding ProviderType}" 
							IsReadOnly="True"
							Width="80"/>
						<data:DataGridTextColumn 
		                    Header="Owner" 
		                    Width="SizeToCells"
		                    Binding="{Binding Owner}" 
							IsReadOnly="True"
							MinWidth="80"/>
						<data:DataGridTextColumn 
		                    Header="Username" 
		                    Width="SizeToCells"
		                    Binding="{Binding ProviderUsername}" 
							IsReadOnly="True"
							MinWidth="100"/>
						<data:DataGridTemplateColumn Header="Password" MinWidth="90">
							<data:DataGridTemplateColumn.CellTemplate>
								<DataTemplate>
								    <StackPanel MouseEnter="ShowPassword" MouseLeave="HidePassword">
								    	<TextBlock Text="●●●●●●"  />
										<TextBlock Text="{Binding ProviderPassword}" Visibility="Collapsed"/>
									</StackPanel>
								</DataTemplate>
							</data:DataGridTemplateColumn.CellTemplate>
						</data:DataGridTemplateColumn>
						<data:DataGridTextColumn 
		                    Header="Server" 
		                    Width="SizeToCells"
		                    Binding="{Binding ProviderServer}" 
							IsReadOnly="True"
							MinWidth="120"/>
						<!--<data:DataGridTextColumn 
		                    Header="Proxy" 
		                    Width="SizeToCells"
		                    Binding="{Binding ProviderOutboundProxy}" 
							IsReadOnly="True"
							MinWidth="120"/>-->
						<data:DataGridCheckBoxColumn 
		                    Header="Register" 
		                    Width="SizeToCells"
		                    Binding="{Binding RegisterActive}" 
							IsReadOnly="True"
							MinWidth="70"/>
						<data:DataGridTextColumn 
		                    Header="Read Only" 
		                    Width="SizeToCells"
		                    Binding="{Binding IsReadOnly}" 
							IsReadOnly="True"
							MinWidth="90"/>
						<data:DataGridTextColumn 
		                    Header="Disabled Reason" 
		                    Width="SizeToCells"
		                    Binding="{Binding RegisterDisabledReason}" 
							IsReadOnly="True"
							MinWidth="120"/>	
						<data:DataGridTemplateColumn Header="Delete" MinWidth="100">
							<data:DataGridTemplateColumn.CellTemplate>
								<DataTemplate>
									<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteSIPProvider" HorizontalAlignment="Center" />
								</DataTemplate>
							</data:DataGridTemplateColumn.CellTemplate>
						</data:DataGridTemplateColumn>
					</data:DataGrid.Columns>
				</data:DataGrid>
			</Border>
		</sipsorceryui:AssetViewPanel>
		<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_sipProviderRegistrationsPanel" Width="Auto" Margin="0,5,0,10">
			<Border BorderBrush="#FFA1FA28" BorderThickness="1,1,1,1" Height="222" x:Name="m_sipProviderRegistrationsBorder" Width="1024">
				<data:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_sipProviderRegistrationsGrid" AutoGenerateColumns="False" FontSize="11" 
				RowBackground="Azure"
				AlternatingRowBackground="LightSteelBlue" Height="Auto" Width="Auto">
				<data:DataGrid.Columns>
					<data:DataGridTextColumn 
		                    Header="Provider Name" 
		                    Width="SizeToCells"
		                    Binding="{Binding ProviderName}" 
							IsReadOnly="True"
							MinWidth="100"/>
				 	<data:DataGridTextColumn 
		               Header="Owner" 
		               Width="SizeToCells"
		               Binding="{Binding Owner}" 
						IsReadOnly="True"
						MinWidth="80"/>
					<data:DataGridTextColumn 
		                    Header="Registrar" 
		                    Width="SizeToCells"
		                    Binding="{Binding RegistrarSIPSocket}" 
							IsReadOnly="True"
							MinWidth="100"/>
					<data:DataGridCheckBoxColumn
						Header="Registered" 
						Width="SizeToCells"
						Binding="{Binding IsRegistered}" 
						IsReadOnly="True"
						MinWidth="80"/>
					<data:DataGridTextColumn 
						Header="Contact" 
						Width="SizeToCells"
						Binding="{Binding Path=BindingURI}" 
						IsReadOnly="True"
						MinWidth="150"/>
					<data:DataGridTextColumn
						Header="Expiry" 
						Width="SizeToCells"
						Binding="{Binding BindingExpiry}" 
						IsReadOnly="True"
						MinWidth="60"/>
					<data:DataGridTextColumn 
						Header="Last Register" 
						Width="SizeToCells"
						Binding="{Binding LastRegisterTimeLocal, Converter={StaticResource DateTimeConverter}}" 
						IsReadOnly="True"
						MinWidth="100"/>
					<data:DataGridTextColumn 
						Header="Last Attempt" 
						Width="SizeToCells"
						Binding="{Binding LastRegisterAttemptLocal, Converter={StaticResource DateTimeConverter}}" 
						IsReadOnly="True"
						MinWidth="100"/>
					<data:DataGridTextColumn 
						Header="Next Attempt" 
						Width="SizeToCells"
						Binding="{Binding NextRegistrationTimeLocal, Converter={StaticResource DateTimeConverter}}" 
						IsReadOnly="True"
						MinWidth="100"/>
					<data:DataGridTextColumn 
						Header="Failure Message" 
						Width="SizeToCells"
						Binding="{Binding RegistrationFailureMessage}" 
						IsReadOnly="True"
						MinWidth="120"/>
				</data:DataGrid.Columns>
			</data:DataGrid>
			</Border>
		</sipsorceryui:AssetViewPanel>
	</StackPanel>
</UserControl>